<template>
  <div>
    <dv-scroll-board :config="config" class="table" style="height:44vh" />
  </div>
</template>

<script>
// import moment from 'moment'
import { blsQuery } from '../../api/dataApi'
export default {
  name: '',
  data() {
    return {
      config: null,
      dataList: [],
    }
  },
  mounted() {
    this.getData()
  },

  watch: {
    dataList(newData) {
      this.config = {
        header: [
          '周计划编号',
          '物料编码',
          '物料名称',
          '规格型号',
          '周计划生产数量',
          '已完工数量',
          '完成进度',
          '计划开始时间',
          '计划结束时间',
        ],
        headerHeight: 24,
        data: newData,
        index: false,
        columnWidth: [180, 150, 150, 150, 200, 150, 160, 180, 180],
        align: ['left'],
        headerBGC: ' ',
        // headerBGC: '#06144f',
        // oddRowBGC: '#06144f',
        oddRowBGC: ' ',
        // evenRowBGC: '#15235c',
        evenRowBGC: 'rgba(52,99,171,0.15)',
        waitTime: '5000',
        rowNum: 8,
      }
    },
  },
  props: {
    cx: {
      type: String,
      default: '',
    },
  },
  methods: {
    getData() {
      const that = this
      const header = {}
      header['report.tableid'] = 'v_smart_workshop_uto_report_chart_left_bottom'
      const params = {
        _params: JSON.stringify(header),
        _conditions: JSON.stringify({}),
        pageIndex: -1,
        // sortField: 'id',
        // sortOrder: 'desc',
      }
      blsQuery(params)
        .then((res) => {
          if (res.code == 0 && res.data && res.data.length > 0) {
            this.qThree(res.data)
          }
        })
        .catch(() => {
          that.$message.error('数据请求失败，请联系管理员！')
        })
    },
    qThree(reportData) {
      const _reportData = []
      reportData.forEach((reportItem) => {
        const _m = []
        _m.push(reportItem['ccode'])
        _m.push(reportItem['invcode'])
        _m.push(reportItem['invname'])
        _m.push(reportItem['invstd'])
        _m.push(reportItem['qty'])
        _m.push(reportItem['qualifiedqty'])
        _m.push(reportItem['percent'] + '%')
        _m.push(reportItem['w_starttime'])
        _m.push(reportItem['w_endtime'])
        _reportData.push(_m)
      })
      this.dataList = _reportData
    },
  },
}
</script>

<style lang="less" scoped>
.tit {
  .px2font(17);
  .px2vh(padding-top, 15);
  letter-spacing: 2px;
  color: #fff;
  text-align: center;
}
.table-list {
  position: relative;
}
.circle {
  width: 1rem;
  height: 1rem;
  border-radius: 20px;
  display: inline-block;
  margin-right: 5px;
}

.table {
  .px2vw(padding-left, 10);
  .px2vw(padding-right, 10);
}
</style>
